// ImageView.h : interface of the CImageView class
//
/////////////////////////////////////////////////////////////////////////////

#if !defined(AFX_IMAGEVIEW_H__9497A97B_F01C_475F_A131_92F2BCC4C39B__INCLUDED_)
#define AFX_IMAGEVIEW_H__9497A97B_F01C_475F_A131_92F2BCC4C39B__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include "SpriteDoc.h"


class CImageView : public CScrollView
{
protected: // create from serialization only
	CImageView();
	DECLARE_DYNCREATE(CImageView)

// Attributes
public:
	CSpriteDoc* GetDocument();

	typedef CSpriteDoc::GROUP GROUP;
	typedef CSpriteDoc::IMAGE IMAGE;

public:
	void Resize();
	void OnLoadImages();
	
protected:
	IMAGE*	m_pSelect;

	union HITIT
	{
		LPVOID	pHitit;
		GROUP*	pGroup;
		IMAGE*	pImage;
	};

	enum {eNull, eGroup, eImage};

	UINT	HitTest(const CPoint& pt, HITIT& refHit);

	int		IMG_CX;
	int		IMG_CY;
	int		TXT_CX;
	int		TXT_CY;
	int		IND_X;
	int		IND_Y;

// Operations
public:

// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CImageView)
	public:
	virtual void OnDraw(CDC* pDC);  // overridden to draw this view
	virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
	protected:
	virtual void OnInitialUpdate(); // called first time after construct
	//}}AFX_VIRTUAL

// Implementation
public:
	virtual ~CImageView();
#ifdef _DEBUG
	virtual void AssertValid() const;
	virtual void Dump(CDumpContext& dc) const;
#endif

protected:

// Generated message map functions
protected:
	//{{AFX_MSG(CImageView)
	afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
	afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point);
	afx_msg BOOL OnMouseWheel(UINT nFlags, short zDelta, CPoint pt);
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()
};

#ifndef _DEBUG  // debug version in ImageView.cpp
inline CSpriteDoc* CImageView::GetDocument()
   { return (CSpriteDoc*)m_pDocument; }
#endif

/////////////////////////////////////////////////////////////////////////////

//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_IMAGEVIEW_H__9497A97B_F01C_475F_A131_92F2BCC4C39B__INCLUDED_)
